<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
    <link rel="shortcut icon" href="${root}images/favicon.ico">
    <link rel="apple-touch-icon-precomposed" href="${root}images/apple-touch-icon.png">
    <title>微信支付</title>
    <link rel="stylesheet" href="${root}css/seedsui.min.css">
<script type="text/javascript" src="${root}js/qrcode.js" ></script>
<style type="text/css">
img{width: 100%;height: 100%;opacity: 1;}
</style>

</head>
<body ontouchstart="">

			<header>
	    <div class="titlebar reverse">
	        <a class="titlebar-button" href="javascript:back()">
                <i class="icon icon-arrowleft"></i>
            </a>
	        <h1 class="titlebar-title text-center">微信支付</h1>
	        <a ><i class="icon "></i></a>
	    </div>
	</header>
    	
    	<article >
    	<!--:if(!isEmpty(res)){  -->
    	<div id="qrcode" style="width: 375px;height: 375px;"></div>
<h1 class="text-center" >微信扫描二维码识别</h1>
<script type="text/javascript">
new QRCode(document.getElementById("qrcode"), "${res.url}");
</script>
<!--:}  -->
</article>

  		<!--- third -->
		<script src="${root}js/jquery-2.1.3.js"></script>
		<script src="${root}js/seedsui.min.js"></script>
    
    <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <script type="text/javascript">
    <!--:if(!isEmpty(wx)){  -->
    function callpay(){
 	   WeixinJSBridge.invoke(
 	       'getBrandWCPayRequest', {
 	           "appId" : '${wx.appId}',     //公众号名称，由商户传入     
 	           "timeStamp": '${wx.timeStamp}',         //时间戳，自1970年以来的秒数     
 	           "nonceStr" : '${wx.nonceStr}', //随机串     
 	           "package" : '${wx.package}',     
 	           "signType" : '${wx.signType}',         //微信签名方式:     
 	           "paySign" : '${wx.paySign}'    //微信签名 
 	       },
 	       
 	       function(res){     
 	           if(res.err_msg == "get_brand_wcpay_request:ok" ) {
 	        	   alert("支付成功!请在订单列表中查看。如遇到问题及时联系我们!");
 	        	   window.location.href="${root}orders/";
 	           }     // 使用以上方式判断前端返回,微信团队郑重提示：res.err_msg将在用户支付成功后返回    ok，但并不保证它绝对可靠。 
 	           else{
 	        	   //alert("支付失败")
 	           }
 	       }
 	   ); 
 	}

 document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
 	  callpay();
 	     // 通过下面这个API隐藏右上角按钮
 	     //WeixinJSBridge.call('hideOptionMenu');
 	     // 发送给好友
 	           
 	 }, false);
 <!--:}  -->
 function back(){history.go(-1);}
</script>
</body>
</html>